package com.ruoyi.system.service.impl;

import java.io.File;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HousekeepingEnclosureMapper;
import com.ruoyi.system.domain.HousekeepingEnclosure;
import com.ruoyi.system.service.IHousekeepingEnclosureService;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-06-17
 */
@Service
public class HousekeepingEnclosureServiceImpl implements IHousekeepingEnclosureService 
{
    @Autowired
    private HousekeepingEnclosureMapper housekeepingEnclosureMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param heId 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public HousekeepingEnclosure selectHousekeepingEnclosureById(Long heId)
    {
        return housekeepingEnclosureMapper.selectHousekeepingEnclosureById(heId);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param housekeepingEnclosure 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<HousekeepingEnclosure> selectHousekeepingEnclosureList(HousekeepingEnclosure housekeepingEnclosure)
    {
        return housekeepingEnclosureMapper.selectHousekeepingEnclosureList(housekeepingEnclosure);
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param housekeepingEnclosure 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertHousekeepingEnclosure(HousekeepingEnclosure housekeepingEnclosure)
    {housekeepingEnclosure.setCreateTime(DateUtils.getNowDate());
        return housekeepingEnclosureMapper.insertHousekeepingEnclosure(housekeepingEnclosure);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param housekeepingEnclosure 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateHousekeepingEnclosure(HousekeepingEnclosure housekeepingEnclosure)
    {housekeepingEnclosure.setUpdateTime(DateUtils.getNowDate());
        return housekeepingEnclosureMapper.updateHousekeepingEnclosure(housekeepingEnclosure);
    }

    /**
     * 批量删除【请填写功能名称】
     * 
     * @param heIds 需要删除的【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteHousekeepingEnclosureByIds(Long[] heIds)
    {
        List<HousekeepingEnclosure> housekeepingEnclosures = housekeepingEnclosureMapper.HousekeepingEnclosureByIds(heIds);
        for (int i = 0; i <housekeepingEnclosures.size(); i++) {
            File file = new File(housekeepingEnclosures.get(i).getUrl());
            file.delete();
        }
        return housekeepingEnclosureMapper.deleteHousekeepingEnclosureByIds(heIds);
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param heId 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteHousekeepingEnclosureById(Long heId)
    {
        return housekeepingEnclosureMapper.deleteHousekeepingEnclosureById(heId);
    }
}
